home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11289 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  41 lines

  1. Newsgroups: alt.msdos.programming,comp.lang.c++,comp.os.msdos.programming,de.comp.lang.c++
  2. Path: Dortmund.Germany.EU.net!artus!elstner
  3. From: elstner@bsi.de (Tilo Elstner - BSI)
  4. Subject: Help: farmalloc doesn't work
  5. Message-ID: <Do7JDE.A6A@bsi.de>
  6. Organization: Bundesamt fuer Sicherheit in der Informationstechnik
  7. Date: Wed, 13 Mar 1996 13:12:49 GMT
  8.  
  9. Second attempt to post this, I fear the first text stayed local only: 
  10.  
  11. Hello,
  12.  
  13. I got trouble with Borland C++ v3.1 for DOS running under OS/2 in a DOS BOX with the following piece of code:
  14.  
  15. -- snip ---
  16.   printf("Memory avail: %li Bytes\n",farcoreleft);
  17.   picture=(unsigned char huge*)farmalloc(483000);
  18.   if (picture==NULL) {
  19.     printf("Not enough memory for picture buffer #1.\n"); exit(8);
  20.   }
  21.   printf("Memory avail after buffer #1: %li Bytes\n",farcoreleft);
  22. -- snap ---
  23.  
  24. Compiler setting is to "HUGE". But farmalloc (and farcalloc, too) won't get memory from the far heap (Under OS/2 with max settings around 500 MByte!). Instead it get memory from the near heap, which size is limited to size of DOS main memory. Thus a 483000 Bytes block doesn't fit, but 480000 does. I tested it under plain DOS, there are some bytes more memory available and it worked.
  25.  
  26. If farmalloc would get the DOS memory first, and then the far memory - OK, I could live with it. But unfortunately farmalloc NEVER gets any memory from my big far heap. 
  27.  
  28. Thanx,
  29.  
  30. Tels
  31.  
  32. ---------------------------------------------------------------------
  33. e-mail      : elstner@bsi.de
  34. fon (duty): 0228/9582-134
  35. fax (duty): 0228/9582-450
  36. ASM Edit  : http://www.inf.tu-dresden.de/~ok3/asmedit.html
  37.       : ftp://ftp.inf.tu-dresden.de/pub/ms-dos/edit/asmedit7.zip
  38. DISCLAIMER: My oppinions are my own, not those of my employer.
  39. ---------------------------------------------------------------------
  40.  
  41.